|
|
I am crossposting this to .programming and .unix because I don't
really know the source of the problem - my incompetence with C++ or my
compiler (gcc).
This isn't really POV-related ATM but will be at some point in time.
Anyway...
I am developing a set of classes for vector operations. Every class is
separated in a separate pair of .hh and .cc files.
The problem occurs when trying to include header file A in B and B in
A. For example,
// $Id: cvector.hh,v 1.6 2001/07/27 13:20:39 peter Exp $
#ifndef CVECTOR_HH_
#define CVECTOR_HH_
#include "ctransf.hh"
class CVector {
... // snipped some stuff to save space
void Transform (const CTransform &);
};
#endif
// $Log: cvector.hh,v $
// Revision 1.6
and then I have this file:
// $Id: ctransf.hh,v 1.2 2001/07/27 14:12:13 peter Exp $
#ifndef CTRANSF_HH_
#define CTRANSF_HH
#include "cvector.hh"
class CTransform {
... // snipped some stuff here too
void CreateRotate (const CVector &);
};
#endif
// $Log: ctransf.hh,v $
The compiler complains that in ctransf.hh, CVector was not declared in
this scope. More precisely, it complains about a parse error before &.
How come? I do include cvector.hh, I do have the proper pre-processor
directives to avoid multiple inclusion...
I was able to build the project by substituting the includes with
dummy class declarations like 'class CVector;' in ctransf.hh and
'class CTransform;' in cvector.hh, but I am 100% sure this will lead
to terrible memory problems during runtime, even though it linked
properly. Right?
Please help me before I lose all my hair over this problem.
Peter Popov ICQ : 15002700
Personal e-mail : pet### [at] vipbg
TAG e-mail : pet### [at] tagpovrayorg
Post a reply to this message
|
|